class library: Volume - use ServerBoot to send synthdef
[supercollider.git] / platform / iphone / iPhone Resources / patches / pitch.rtf
blob30e0203d2a1ad3ab331cdad405d0722c38d6d030
1 {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
2 {\fonttbl\f0\fnil\fcharset0 Monaco;}
3 {\colortbl;\red255\green255\blue255;\red0\green0\blue191;\red0\green36\blue181;\red96\green96\blue96;
5 \deftab720
6 \pard\pardeftab720\ql\qnatural
8 \f0\fs18 \cf2 Server\cf0 .default = \cf2 Server\cf0 .internal;\
9 s = Server.internal;\
10 s.waitForBoot(\
11 \{\cf3  \
12         SynthDef\cf0 (\cf4 "pitchFollow2"\cf0 ,\{\cf4 \
13         \cf0    \cf3 var\cf0  in, amp, freq, hasFreq, out;\
14                 in = \cf3 Mix\cf0 .new(\cf3 SoundIn\cf0 .ar([0,1]));\
15                 amp = \cf3 Amplitude\cf0 .kr(in, 0.05, 0.05);\
16                 # freq, hasFreq = \cf3 Pitch\cf0 .kr(in, ampThreshold: 0.02, median: 7);\
17                 out = \cf3 CombC\cf0 .ar(\cf3 LPF\cf0 .ar(in, 1000), 0.1, (2 * freq).reciprocal, -6).distort * 0.05;\
18                 6.do(\{\
19                         out = \cf3 AllpassN\cf0 .ar(out, 0.040, [0.040.rand,0.040.rand], 2)\
20                 \});\
21                 \cf3 Out\cf0 .ar(0,out);\
22         \}).play(s);\
23 \});}